package com.huawei.appmarket.support.thirdprovider;

import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.net.Uri;
import com.huawei.appmarket.support.thirdprovider.appvalidate.AppValidateManager;
import o.diu;
import o.Logger;
import o.dzy;
import o.ebq;
import o.epz;
import o.euj;
import o.euk;
import o.eus;

public class ThirdProvider extends ContentProvider {
    private static final UriMatcher ॱ = new UriMatcher(-1);

    static {
        ॱ.addURI(euk.ॱ, "image/*", 1);
        ॱ.addURI(euk.ॱ, "search/*", 2);
        ॱ.addURI(euk.ॱ, "validate", 3);
        ॱ.addURI(euj.ॱ, "item/*", 1);
        ॱ.addURI(euk.ॱ, "content_grade", 4);
        ॱ.addURI(euk.ॱ, "download", 5);
    }

    public boolean onCreate() {
        return false;
    }

    public Cursor query(Uri uri, String[] strArr, String str, String[] strArr2, String str2) {
        try {
            if (!diu.ˊ().ˎ() && ॱ.match(uri) != 1) {
                Logger.e("ThirdProvider", "not agree protocal.");
                return null;
            } else if (ॱ.match(uri) == 3) {
                if (strArr != null && strArr2 != null) {
                    return new AppValidateManager().getAppCheckInfo(strArr, strArr2);
                }
                Logger.e("ThirdProvider", "ITEM_ID_VALIDATE  projection == null || selectionArgs == null");
                return null;
            } else if (ॱ.match(uri) == 4) {
                return dzy.ॱ();
            } else {
                switch (ॱ.match(uri)) {
                    case 1:
                        if (epz.ॱ(strArr2)) {
                            return null;
                        }
                        String str3;
                        String ˋ = ˋ(uri);
                        int parseInt = Integer.parseInt(strArr2[0]);
                        if (strArr2.length >= 2) {
                            str3 = strArr2[1];
                        } else {
                            str3 = null;
                        }
                        return euj.ˏ(ˋ, parseInt, str3);
                    case 2:
                        return ebq.ॱ().ॱ(uri.getPath().substring("search/*".length()), strArr, strArr2);
                    case 5:
                        return ˎ(strArr2);
                    default:
                        return null;
                }
            }
        } catch (Exception e) {
            Logger.e("ThirdProvider", "query(...)  " + e.toString());
            return null;
        }
    }

    private MatrixCursor ˎ(String[] strArr) {
        if (epz.ॱ(strArr) || strArr.length < 2) {
            return null;
        }
        return eus.ˏ(strArr[0], Integer.parseInt(strArr[1]));
    }

    protected String ˋ(Uri uri) {
        try {
            return uri.getPath().substring("image/*".length());
        } catch (IndexOutOfBoundsException e) {
            return "";
        }
    }

    public String getType(Uri uri) {
        return null;
    }

    public Uri insert(Uri uri, ContentValues contentValues) {
        return null;
    }

    public int delete(Uri uri, String str, String[] strArr) {
        return 0;
    }

    public int update(Uri uri, ContentValues contentValues, String str, String[] strArr) {
        return 0;
    }
}
